<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        var d = new Date()

        console.log(Date.now())
        console.log(d.getDate()) //获取当前的日
        console.log(d.getDay()) //获取当前是周几
        console.log(d.getFullYear()) //获取当前的年
        console.log(d.getHours()) //获取当前的小时
        console.log(d.getMonth() + 1) //获取当前的月 0-11

        function getDate(){
            var now = new Date()
            var year = now.getFullYear()
            var late = new Date(year,12,31,0,0,0)
            var days = (late - now)/(1000*60*60*24)
            console.log('距离今年结束还有'+ days + '天')


        }

        getDate()


    </script>


</body>
</html>